home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>9. Using Script-Fu Scripts</title> <link rel="stylesheet" href="gimp-help-plain.css" type="text/css" /> <link rel="stylesheet" href="gimp-help-screen.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.66.1" /> <link rel="start" href="index.html" title="GIMP User Manual" /> <link rel="up" href="ch02.html" title="Chapter 2. Using Gimp" /> <link rel="prev" href="ch02s08s04.html" title="8.4. Writing Plugins" /> <link rel="next" href="ch02s10.html" title="10. A Script-Fu Tutorial" /> </head> <body> <div xmlns="" class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center" id="chaptername">Chapter 2. Using <span xmlns="http://www.w3.org/1999/xhtml" class="acronym">Gimp</span></th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="ch02s08s04.html">Prev</a> </td> <th width="60%" align="center" id="sectionname">9. Using Script-Fu Scripts</th> <td width="20%" align="right"> <a accesskey="n" href="ch02s10.html">Next</a></td> </tr> </table> <hr /> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="gimp-using-script-fu"></a>9. Using Script-Fu Scripts</h2> </div> </div> </div> <a id="id3428492" class="indexterm"></a> <div class="simplesect" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id3428506"></a>Script-Fu?</h3> </div> </div> </div> <p> Script-Fu is what the Windows world would call "macros" But Script-Fu is more powerful than that. Script-Fu is based on an interpreting language called Scheme, and works by using querying functions to the Gimp database. You can do all kinds of things with Script-Fu, but an ordinary Gimp user will probably use it for automating things that: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> You want to do frequently. </p> </li> <li> <p> Are really complicated to do, and hard to remember. </p> </li> </ul> </div> <p> Remember that you can do a whole lot with Script-Fu. The scripts that come with Gimp can be quite useful, but they can also serve as models for learning Script-Fu, or at least as a framework and source of modification when you make your own script. Read the Script-Fu Tutorial in the next section if you want to learn more about how to make scripts. </p> <p> We will describe some of the most useful scripts in this chapter, but we won't cover them all. There are simply too many scripts. Some of the scripts are also very simple and you will probably not need any documentation to be able to use them. </p> <p> Script-Fu (a dialect of Scheme) isn't the only scripting language available for Gimp. But Script-Fu is the only scripting language that is installed by default. Other available scripting extensions are Perl and Tcl. You can download and install both extensions at the <a href="http://registry.gimp.org" target="_top">Gimp Plugin Registry</a>. </p> </div> <div class="simplesect" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id3428576"></a>Installing Script-Fus</h3> </div> </div> </div> <p> One of the great things about Script-Fu is that you can share your script with all your Gimp friends. There are many scripts that come with Gimp by default, but there are also vast quantities of scripts that are available for download all around the Internet. </p> <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Tip"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Tip]" src="../images/tip.png" /> </td> <th align="left">Tip</th> </tr> <tr> <td colspan="2" align="left" valign="top"> <p> If you have downloaded a script, copy or move your new script to your <tt class="filename">.gimp-2.0/scripts</tt> directory and do a refresh. The script will now appear in one of your menus. If you don't find it, look for it under the root file menu filters. If it doesn't appear at all, something was wrong with the script. </p> </td> </tr> </table> </div> <p> Note that you can't use more than one Script-Fu dialog at a time, so don't open a script and one more after that. The last one will never be opened and displayed. </p> </div> <div class="simplesect" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id3428619"></a>Do's and Don'ts</h3> </div> </div> </div> <p> A common error when you are dealing with Script-Fus is that you simply bring them up and press the OK button. When nothing happens, you probably think that the script is broken or buggy, but there is most likely nothing wrong with it. </p> <p> Think again. Did you really read the information in the dialog, or did you just press the button? If you forgot an input the script needs, or if you gave it the wrong input, the script will fail. One of the most common errors is that the font specified in the script dialog hasn't been installed on your system. So please check the information in the dialog before blaming the script. </p> </div> <div class="simplesect" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id3428647"></a>Different Kinds Of Script-Fus</h3> </div> </div> </div> <p> There are two kinds of Script-Fus -- standalone scripts and image-dependent scripts. You will find the standalone variants under <span class="guimenu">Xtns</span>-><span class="guisubmenu">Script-Fu</span>-><span class="guimenuitem"><i class="replaceable"><tt>Type of Script</tt></i></span> in the main toolbox menu, and the image-dependent scripts are placed under <span class="guimenu">Script-Fu</span>-><span class="guimenuitem"><i class="replaceable"><tt>Type of Script</tt></i></span> in the image menu. </p> </div> <div class="simplesect" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id3428703"></a>Standalone Scripts</h3> </div> </div> </div> <p> We will not try to describe every script in depth. Most Script-Fus are very easy to understand and use. At the time of this writing, the following types are installed by default: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> Patterns </p> </li> <li> <p> Web page themes </p> </li> <li> <p> Logos </p> </li> <li> <p> Buttons </p> </li> <li> <p> Utils </p> </li> <li> <p> Make Brush </p> </li> <li> <p> Misc. </p> </li> </ul> </div> <div class="variablelist"> <dl> <dt> <span class="term">Patterns</span> </dt> <dd> <p> You will find all kinds of pattern-generating scripts here. Generally, they are quite useful because you can add many arguments to your own patterns. </p> <p> We'll take a look at the Land script. In this script you have to set the image/pattern size, and specify what levels of random to use for your land creation. The colors used to generate the land map are taken from the currently selected gradient in the gradient editor. You must also supply values for the level of detail, land and sea height/depth and the scale. Scale refers to the scale of your map, just as in an ordinary road map, 1:10 will be typed as 10. </p> </dd> <dt> <span class="term">Web Page Themes</span> </dt> <dd> <p> Here is clearly a practical use for scripts. By creating a script for making custom text, logos, buttons arrows, etc., for your web site, you will give them all the same style and shape. You will also be saving a lot of time, because you don't have to create every logo, text or button by hand. </p> <p> You will find the Gimp.org theme under the Web page theme submenu. If you want to create your own theme, this script will serve as an excellent template that you can modify to create a theme for your web site. </p> <p> Most of the scripts are quite self-explanatory, but here are some hints: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> Leave all strange characters like ' and " intact. </p> </li> <li> <p> Make sure that the pattern specified in the script exists. </p> </li> <li> <p> Padding refers to the amount of space around your text. </p> </li> <li> <p> A high value for bevel width gives the illusion of a higher button. </p> </li> <li> <p> If you type TRUE for "Press", the button will look pushed down. </p> </li> <li> <p> Choose transparency if you don't want a solid background. If you choose a solid background, make sure it is the same color as the web page background. </p> </li> </ul> </div> </dd> <dt> <span class="term">Logos</span> </dt> <dd> <p> Here you will find all kinds of logo-generating scrips. This is nice, but use it with care, as people might recognize your logo as being made by a known Gimp script. You should rather regard it as a base that you can modify to fit your needs. The dialog for making a logo is more or less the same for all such scripts: </p> <div class="orderedlist"> <ol type="1"> <li> <p> In the Text String field, type your logo name, like Frozenriver. </p> </li> <li> <p> In the Font Size text field, type the size of your logo in pixels. </p> </li> <li> <p> In the Font text field, type the name of the font that you want to use for your logo. </p> </li> <li> <p> To choose the color of your logo, just click on the color button. This brings up a color dialog. </p> </li> <li> <p> If you look at the current command field, you can watch the script run. </p> </li> </ol> </div> </dd> <dt> <span class="term">Make Buttons</span> </dt> <dd> <p> Under this headline you'll find a script that makes beveled buttons. The script has a dozen parameters or so, and most of them are similar to those in the logo scripts. You can experiment with different settings to come up with a button you like. </p> </dd> <dt> <span class="term">Utils</span> </dt> <dd> <p> Under Utils you will find a small but nice script: the Fontmap script, which makes an image of your fonts. You will have to type the names of the fonts you want displayed in the Fonts text field. </p> <p> The Custom gradient script creates an image of the current custom gradient in the gradient editor. This can be useful if you want to pick colors from a gradient as in a palette. </p> </dd> <dt> <span class="term">Misc.</span> </dt> <dd> <p> Under Misc. you'll find scripts that can be quite useful, but aren't suitable for the other submenus. An example is the Sphere script. You will have to set the radius in pixels to determine the sphere size. The lighting angle is where at the sphere you point the spotlight. This value also has an impact on the sphere shadow. If you don't want a shadow, you will have to type FALSE. The last thing you have to select is background color, and the color of your sphere. </p> </dd> <dt> <span class="term">Make Brush</span> </dt> <dd> <p> This script lets you make your own custom rectangular/circular brushes, with or without feathered (blurred) edges. The script will automatically store your brush in your personal brush directory. You just have to press refresh in the Brush Selection dialog to use your newly created brush. </p> </dd> </dl> </div> </div> <div class="simplesect" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id3428948"></a>Image-Dependent Scripts</h3> </div> </div> </div> <p> These are scripts that perform operations on an existing image. In many ways they are like the plug-ins in the Filters menu. The following script groups are installed by default: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> Decor </p> </li> <li> <p> Modify </p> </li> <li> <p> Animators </p> </li> <li> <p> Stencil Ops </p> </li> <li> <p> Alchemy </p> </li> <li> <p> Shadow </p> </li> <li> <p> Render </p> </li> <li> <p> Utils </p> </li> <li> <p> Selection </p> </li> </ul> </div> <div class="variablelist"> <dl> <dt> <span class="term">Stencil Ops</span> </dt> <dd> <p> Here, you'll find two scripts: Carve-It and Chrome-It, which can render some truly nice artistic effects on grayscale images. </p> </dd> <dt> <span class="term">Drop Shadow</span> </dt> <dd> <p> Drop Shadow will cast a shadow behind your selected object. It has three important parameters. X and Y offset determine where the shadow will be placed in relation to the selected object. Offset is measured in pixels. High values make the shadow look like it's far away, and low values will make it look closer to the object. The blur value is also important, because a shadow that is cast far from the object has a higher blur level. </p> </dd> <dt> <span class="term">Perspective Shadow</span> </dt> <dd> <p> Perspective Shadow has a very important parameter: the perspective angle. If this angle is set to 0 or 180, there will be no shadow, because the script assumes that the object has no thickness. This also means that this script looks fine in certain angles, but unnatural in others. The other parameters are quite self-explanatory. You'll get more blur if the horizon is far away, and the shadow length is the length in relation to the selected object. </p> </dd> </dl> </div> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="ch02s08s04.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="ch02.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="ch02s10.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">8.4. Writing Plugins </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> 10. A Script-Fu Tutorial</td> </tr> </table> </div> </body> </html>